#include<iostream>
#include "LinerList.h"
using namespace std;

LinerList::LinerList(int capacity){
    linerList=new int[capacity];
    linerCapacity=capacity;
    linerSize=0;
}
LinerList::~LinerList(){

}
void LinerList::traverse(){
    for (int i = 0; i < linerSize; i++)
    {
        cout<<linerList[i]<<endl;
        /* code */
    }
    

}
int LinerList::get(int idx){
    return linerList[idx];
}
void LinerList::insert(int val){
    if (linerSize+1==linerCapacity)
    {
        cout<<"The linersize more than capacity";
        /* code */
    }
    linerList[linerSize]=val;
    linerSize++;
}
//1 2 3 8 5 6 
//2 1 3 7 9 5
//
int* LinerList::unionList(LinerList a){

    for (int i = 0; i <a.linerSize; i++)
    {
        int isNotEqualFlag=true;
        for (int j = 0; j < linerCapacity; j++)
        {
            if (a.linerList[i]==linerList[j])
            {
                isNotEqualFlag=false;
                break;
                /* code */
            }
            /* code */
        }
        cout<<"liner size:"<<linerSize<<"b liner capacity:"<<linerCapacity<<endl;
        if (isNotEqualFlag&&linerSize+1<linerCapacity){

             linerList[linerSize++]=a.linerList[i];
                /* code */
            }
        else{
            cout<<"The size max than capacity";
        }
        
    }
    
}